package com.zjdiepu.www.commpent.mapper.dh;

import javax.annotation.Resource;

import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.stereotype.Component;

import com.zjdiepu.www.base.core.BaseMapper;
import com.zjdiepu.www.base.enums.status.InsuranceStatus;
import com.zjdiepu.www.base.enums.type.DataDicType;
import com.zjdiepu.www.commpent.RedisObjectClient;
import com.zjdiepu.www.model.base.dto.SimpleDataDictionary;
import com.zjdiepu.www.model.dh.dto.DhInsuranceRenewal;
import com.zjdiepu.www.util.CachedEnums;
/**
 * 项目名称：dpqc-parent-manager-information <br/> 
 * 类名称：YwBusinessMapper <br/>  
 * 类描述：字段转换 <br/>    
 * 创建人：xiongxiaotun <br/> 
 * 创建时间：2017年4月25日 下午5:51:41  <br/>   
 * 修改人：xiongxiaotun <br/> 
 * 修改时间：2017年4月25日 下午5:51:41   <br/>  
 * 修改备注：    <br/> 
 * @version V1.0   <br/>
 */
@Component
public class DhInsuranceRenewalVoMapper extends BaseMapper<DhInsuranceRenewal>{
	@Resource
	private RedisObjectClient redisObjectClient;

	@Override
	public void mapper(RedisConnection redisConnection,DhInsuranceRenewal m) {
		if(null == m) {
			return;
		}
		Integer statusRenewal = m.getStatusRenewal();
		m.setStatusRenewalDisplay((String)CachedEnums.getValue(statusRenewal, InsuranceStatus.class));
		String nameCompany = m.getNameCompany();
		SimpleDataDictionary nameCompanyDic = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), nameCompany, DataDicType.INSURANCE_COMPANY.getCode());
		m.setNameCompanyDisplay(nameCompanyDic == null ? "" : nameCompanyDic.getName());
	}
}
